package com.example.shopdemo.enums;

/**
 * @author ：Anitaxiaofeng
 * @description：
 * @create 2018-01-16
 **/
public enum ShopStateEnum {

    CHECK(0, "审核中"),
    OFFLINE(-1, "非法商铺"),
    SUCCESS(1, "操作成功"),
    PASS(2, "通过认证"),
    INNER_ERROR(-1001, "操作失败"),
    NULL_SHOPID(-1002, "ShopId为空"),
    NULL_SHOP_INFO(-1003, "传入了空的信息");


    private int key;
    private String value;

    ShopStateEnum(int key,String value){
        this.key = key;
        this.value = value;
    }

    public int getKey(){
        return key;
    }

    public String getValue(){
        return value;
    }

    public static ShopStateEnum valueOf(int index){
        for(ShopStateEnum state:values()){   //values()返回ShopStateEnum的数组
            if(state.getKey()==index){
                return state;
            }
        }
        return null;
    }
}
